import { createStore } from 'hox';
import { useState } from 'react';

const [useCounterStore, CounterStoreProvider] = createStore(() => {
  const [counter, setCount] = useState(0);

  const increment = () => setCount(counter + 1);
  const decrement = () => setCount(counter - 1);

  return {
    counter,
    increment,
    decrement,
  };
});

export { useCounterStore, CounterStoreProvider };
